package com.flyqiu.flow.api.candidate;

import com.flyqiu.common.dict.Dict;
import com.flyqiu.common.user.FlyQiuUser;

import java.util.Collection;

public interface FlowCandidateLoad<T extends FlyQiuUser, C extends FlowCandidateContext, CI extends FlowInstCandidateContext> extends Dict<String> {
    @Override
    default String getLabel() {
        return getValue();
    }

    /**
     * 加载候选人信息
     *
     * @param candidateContext
     * @return
     */
    @SuppressWarnings("unchecked")
    default Collection<? extends T> loadInstCandidates(CI candidateContext) {
        return loadElementCandidates((C) candidateContext);
    }

    /**
     * 加载候选人信息
     * @param candidateContext
     * @return
     */
    Collection<? extends T> loadElementCandidates(C candidateContext);
}
